#!/bin/csh -f

#**************************************************************************
#**
#**    Copyright (c) 1995-1997 by ABKGroup, UCLA VLSI CAD Laboratory,
#**    UCLA Computer Science Department, Los Angeles, CA 90095-1596 USA,
#**    and by the Regents of the University of California.
#**    All rights reserved.
#**
#**    No portion of this file may be used, copied, or transmitted for
#**    any purpose, including any research or commercial purpose,
#**    without the express written consent of Professor Andrew B. Kahng,
#**    UCLA Computer Science Department, 3713 Boelter Hall, Los Angeles,
#**    CA 90095-1596 USA.   Any copy made of this file must include this
#**    notice.    ABKGroup and the Regents of the University of California
#**    retain title to all copies of this file and/or its compiled
#**    derivatives.
#**
#**************************************************************************/

set DIFF=/usr/bin/diff
set WC=/usr/bin/wc
set PROG=./ABKCommonTest

/bin/rm -f diffs.notime seeds.{in,out}

echo -n "Running test0  ..."
echo -n "Running test0  ..." >> newout
${PROG}0.exe > newout
${PROG}0.exe -help  >> newout
${PROG}0.exe --help >> newout
${PROG}0.exe +cloak >> newout
${PROG}0.exe -aux filename.aux -n -sanity >> newout
${PROG}0.exe -aux filename.aux -sanity 0.0001 -n 25 >> newout
echo Ok
echo -n "Running test2  ..."
echo -n "Running test2  ..." >> newout
echo "-----------------------" >> newout
${PROG}2.exe >> newout
echo Ok
echo -n "Running test3  ..."
echo -n "Running test3  ..." >> newout
echo "-----------------------" >> newout
${PROG}3.exe >> /dev/null
echo Ok
echo -n "Running test4  ..."
echo -n "Running test4  ..." >> newout
echo "-----------------------" >> newout
echo " 2 and 3" |${PROG}4.exe >> newout
echo Ok
echo -n "Running test5  ..."
echo -n "Running test5  ..." >> newout
echo "-----------------------" >> newout
${PROG}5.exe >>& newout
echo Ok
echo -n "Running test7  ..."
echo -n "Running test7  ..." >> newout
echo "-----------------------" >> newout
${PROG}7.exe >> newout
echo Ok

echo -n "Running test9  ..."
echo -n "Running test9  ..." >> newout
echo "-----------------------" >> newout
/bin/rm -f seeds.in
echo "0" >> seeds.in
echo "3819098400" >> seeds.in
echo "2" >> seeds.in
echo "0" >> seeds.in
echo "8" >> seeds.in
echo "8" >> seeds.in
${PROG}9.exe >>& newout
echo "---------------------- seeds.out:----------" >> newout
cat seeds.out >> newout
echo Ok

echo -n "Running test10 ..."
echo -n "Running test10 ..." >> newout
echo "-----------------------" >> newout
${PROG}10.exe >> newout
echo Ok

echo -n "Running test11 ..."
echo -n "Running test11 ..." >> newout
echo "-----------------------" >> newout
${PROG}11.exe >> newout
echo Ok

echo -n "Running test13 ..."
echo -n "Running test13 ..." >> newout
echo "-----------------------" >> newout
${PROG}13.exe >> newout
echo Ok

echo -n "Running test16 ..."
echo -n "Running test16 ..." >> newout
echo "-----------test16-----" >> newout
/bin/rm -rf seeds.in
echo "0" >> seeds.in
echo "4040668743" >> seeds.in
${PROG}16.exe >>& newout
echo Ok

echo -n "Running test19 ..."
echo -n "Running test19 ..." >> newout
echo "-----------test19-----" >> newout
${PROG}19.exe >>& newout
echo Ok

echo -n "Running test20a ..."
echo -n "Running test20a ..." >> newout
echo "-----------test20a-----" >> newout
${PROG}20.exe >>& newout
cat seeds.out >> newout
echo Ok

echo -n "Running test20b ..."
echo -n "Running test20b ..." >> newout
echo "-----------test20b-----" >> newout
/bin/rm -f seeds.in
${PROG}20.exe >>& newout
cat seeds.out >> newout
echo Ok

echo -n "Running test21 ..."
echo -n "Running test21 ..." >> newout
echo "-----------test21-----" >> newout
${PROG}21.exe >>& newout
echo Ok

egrep -vi "(Created|sec|in seed.cxx)" newout > newout.notime
egrep -vi "(Created|sec|in seed.cxx)" expectedout > expectedout.notime
$DIFF newout.notime expectedout.notime > diffs.notime

echo " "
echo Differences from precomputed results
echo "  lines:  words:  bytes:    error log:"
$WC diffs.notime
